package com.zang.singleton;

import com.zang.concurrent.collections.ThreadPool;

import java.util.concurrent.ExecutorService;

/**
 * @author Zhang Qiang
 * @Date 2019/9/20 11:34
 */
public class Action {

    public static void main(String[] args) {

        ExecutorService cacheService = ThreadPool.getPool().get("");
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + " start ");
                SingleThreadSingleton singleThreadSingleton = SingleThreadSingleton.getInstance();
            }
        };
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + " start ");
                SingleThreadSingleton singleThreadSingleton = SingleThreadSingleton.getInstance();
            }
        });
        for (int i = 0; i < 100; i++) {

            cacheService.execute(runnable);

            thread.setName("thread - " + i);
            thread.start();
        }

    }

}
